package it.koutifaris.travianmap.transformation;

public class MultiTransformation implements XYTransformation {

	private XYTransformation[] transformations;

	public MultiTransformation(XYTransformation... transformations) {
		this.transformations = transformations;
	}

	@Override
	public double transformX(double x) {
		double result = x;

		for (XYTransformation transformation : transformations) {
			result = transformation.transformX(result);
		}

		return result;
	}

	@Override
	public double transformY(double y) {
		double result = y;

		for (XYTransformation transformation : transformations) {
			result = transformation.transformY(result);
		}

		return result;
	}

}
